Skip to content

Conversation

anvivats
Copy link

@anvivats anvivats commented Jul 11, 2025

  • closes DOC: .str.cat output in case of Index object #35556
  • Tests added and passed — N/A (doc-only change)
  • All code checks passed — pre-commit and CI should pass
  • Added type annotations — N/A (no new code added)
  • Added an entry in the latest whatsnew — N/A (doc-only update)

Summary of Changes

This PR improves the docstring for str.cat() to clarify what happens when the caller is an Index and others is None.

Specifically, the doc now explains that in this case, the output is also an Index containing a single string, rather than a plain str as it is for Series.

Example added:

>>> idx = pd.Index(["a", "b", np.nan])
>>> idx.str.cat(sep="-")
Index(['a-b'], dtype='object')

@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: .str.cat output in case of Index object
3 participants